﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="AdminProductInfo.aspx.cs" Inherits="TakeoutMangesWeb.ProductInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .pagination {
        margin-left:400px;
        }
        .pagination li{
        height:30px;
        float:left;
        width:60px;
        text-align:center;
        border:1px solid white;
        }
            .pagination li {
            line-height:30px;
            }
        .txtPNM {
        width:100px;
        margin:10px;
        border-radius:10px;
        }
        
        .layui-btn {
        margin-left:10px;
        }
        #sj {
        display:block;
        }
        #xj {
        display:block;
        }
    </style>
    <script type="text/javascript">
        $(function () {
            $(".state").each(function () {
                console.log($(this).children("a").text() == "已上架");
                if ($(this).children("a").text() == "已上架") {
                    $(this).next().children(".sj").hide().siblings().show();
                }
                else {
                    $(this).next().children(".xj").hide().siblings().show();
                }
            })
        })
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form runat=server >
        <asp:TextBox ID="TextBox1" class="txtPNM" runat="server" Height="25px" Width="150px"></asp:TextBox><asp:Button ID="Button1" class="layui-btn layui-btn-warm"  runat="server" Text="搜索" onclick="Button1_Click" Height="30px" Width="60px"/>
        <asp:Button ID="Button2" class="layui-btn"  runat="server" Text="查看全部"  Height="30px" Width="84px" OnClick="Button2_Click"/>
     <asp:Repeater ID="Repeater1" runat="server">
        <HeaderTemplate><table style="margin:0 auto" class="layui-table layui-form">
                <th>商品编号</th>
                <th>商品名称</th>
                <th>商品价格</th>
                <th>商品销量</th>
                <th>类别</th>
                <th>状态</th>
                <th>操作</th>
                </HeaderTemplate>
        <ItemTemplate>
          <tr>
              <td><%#Eval("ProductID") %></td>
             <td><%#Eval("ProductName") %></td>
             <td><%#Eval("ProductPrice") %></td>
             <td><%#Eval("ProductSales") %></td>
             <td><%#Eval("CategoryID") %></td>
             <td class="state" runat="server"><%#Eval("Isdelete").ToString()!="0"?"<a class='layui-btn layui-btn-danger'>已上架</a>":"<a class='layui-btn layui-btn-normal layui-btn-mini'>未上架</a>"%></td>
             <td >
               <a class="layui-btn layui-btn-normal layui-btn-mini xj"  href='/MyHandler/DownProductHandler.ashx?id=<%#Eval("ProductID")%>'>下架</a>
               <a class="layui-btn layui-btn-danger sj" href="./MyHandler/UpProductHandler.ashx?id=<%#Eval("ProductID")%>">上架</a></td>
         </tr></ItemTemplate>
        <FooterTemplate></table></FooterTemplate>
    </asp:Repeater></form>
    <ul class="pagination">
        <%=pageaa %>
        <%--<% for (int i = 1; i <= PageLenth; i++)
            {
        %>
        <li class="page-item <%=CurrentPage==i?"active":"" %>"><a class="page-link" href="Driver.aspx?page=<%=i %>"><%=i %></a>
            <% }
            %>--%>
    </ul>
</asp:Content>
